package com.jg.xmlSchema2JsonSchema.xsd;

import com.jg.xmlSchema2JsonSchema.xsd.util.XsdUtil;
import org.w3c.dom.Element;

/**
 * @author czg
 */
public class XsPattern {
    private Element element;
    private String value;
    private String annotation;
    private String id;

    public XsPattern(Element element) {
        this.element = element;
        getData();
    }

    private void getData() {
        XsAnnotation xsAnnotation = XsdUtil.getAnnotation(element);
        if (xsAnnotation != null) {
            annotation = xsAnnotation.getText();
        }
        value = element.getAttribute("value");
        id = element.getAttribute("id");
    }

    public String getValue() {
        return value;
    }

    public String getAnnotation() {
        return annotation;
    }

    public String getId() {
        return id;
    }

    public Element getXmlElement() {
        return element;
    }

}
